<template>
  <div>
    <div align="left">我的位置&gt;&gt;科技项目申报&gt;单位信息</div>
    <div id="container">
      <div id="content2">
        <table width="100%" height="41" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td height="4" colspan="2" align="left" valign="bottom"></td>
          </tr>
          <tr>
            <td height="15" align="left" valign="top">&nbsp;</td>
            <td height="15" align="left" valign="top" class="12">
              <table width="100%" height="20" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td height="20" align="center">
                    <div class="right_proaducts">
                    </div>
                    <div class=padding>
                      <div id=middlebody>
                        <table :data="unitInfo" width="70%" border="0" cellpadding="0" cellspacing="1">
                          <tbody>
                          <tr>
                            <td width="30%" height="31" align="middle" bgcolor="#f3f3f3">单位名称
                            </td>
                            <td width="70%" align="left" bgcolor="#f3f3f3">
                              <div align="left">
                                <input v-model="unitInfo.unitname"
                                       name="unitname"/>
                              </div>
                            </td>
                          </tr>
                          <tr>
                            <td align="middle" bgcolor="#f3f3f3">单位地址</td>
                            <td width="70%" align="left" bgcolor="#f3f3f3"><input id="address"
                                                                                  v-model="unitInfo.address"
                                                                                  name="address"/>
                            </td>
                          </tr>
                          <tr>
                            <td align="middle" bgcolor="#f3f3f3">单位法人</td>
                            <td align="left" bgcolor="#f3f3f3"><input id="corporation"
                                                                      v-model="unitInfo.corporation"
                                                                      name="corporation"/>
                            </td>
                          </tr>
                          <tr>
                            <td align="middle" bgcolor="#f3f3f3">注册资金</td>
                            <td align="left" bgcolor="#f3f3f3"><input id="investment"
                                                                      v-model="unitInfo.investment"
                                                                      name="investment"/>
                            </td>
                          </tr>
                          <tr>
                            <td align="middle" bgcolor="#f3f3f3">单位性质</td>
                            <td align="left" bgcolor="#f3f3f3"><input id="type"
                                                                      v-model="unitInfo.type"
                                                                      name="type"/>
                            </td>
                          </tr>
                          <tr>
                            <td align="middle" bgcolor="#f3f3f3">单位电话</td>
                            <td align="left" bgcolor="#f3f3f3"><input id="tel"
                                                                      v-model="unitInfo.tel"
                                                                      name="tel"/>
                            </td>
                          </tr>
                          <tr>
                            <td align="middle" bgcolor="#f3f3f3">单位邮箱</td>
                            <td align="left" bgcolor="#f3f3f3"><input id="email"
                                                                      v-model="unitInfo.email"
                                                                      name="email"/>
                            </td>
                          </tr>
                          <tr>
                            <td align="middle" bgcolor="#f3f3f3">单位传真</td>
                            <td align="left" bgcolor="#f3f3f3"><input id="fax"
                                                                      v-model="unitInfo.fax"
                                                                      name="fax"/>
                            </td>
                          </tr>
                          <tr>
                            <td align="middle" bgcolor="#f3f3f3">单位邮编</td>
                            <td align="left" bgcolor="#f3f3f3"><input id="zipcode"
                                                                      v-model="unitInfo.zipcode"
                                                                      name="zipcode"/>
                            </td>
                          </tr>
                          <tr>
                            <td align="middle" bgcolor="#f3f3f3">单位简介</td>
                            <td align="left" bgcolor="#f3f3f3"><textarea
                                v-model="unitInfo.introduction"
                                name="introduction"
                                rows="3" cols="50">great company</textarea>
                            </td>
                          </tr>
                          <tr>
                            <td align="middle" bgcolor="#f3f3f3">&nbsp;</td>
                            <td align="left" bgcolor="#f3f3f3"><input type="button"
                                                                      @click="submitInfo()"
                                                                      value="修改"
                                                                      name="submit2"/>
                              <input id="button2" type="reset" value="取消" name="button2"/>
                            </td>
                          </tr>
                          </tbody>
                        </table>
                      </div>
                    </div>
                  </td>
                </tr>
              </table>
              <br/>
              <div class="table_wz"></div>
            </td>
          </tr>
        </table>
      </div>
    </div>
    <div id="container">
      <div id="footer">
        <p><a href="http://www.ascenttech.com.cn/" target="_blank">版权所有：北京亚思晟商务科技有限公司 &copy;2004-2008|京ICP备05005681</a>
        </p>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "unitInfo",
  data() {
    return {
      uid: JSON.parse(sessionStorage.getItem("userInfo")).uid || '',
      unitInfo: {},
    }
  },
  mounted() {
    this.selectUnitInfo();
  },
  methods: {
    //注销
    logout() {
      sessionStorage.clear();
    },
    //获取项目信息
    selectUnitInfo() {
      var _this = this;
      this.$axios({
        url: `http://localhost:8080/api/unit/unitInfo/${_this.uid}`,
        method: 'get',
      }).then((res) => {
        console.log(res);
        _this.unitInfo = res.data.data;
      })
    },
    submitInfo() {
      var _this = this;
      this.$axios({
        url: `http://localhost:8080/api/unit/updateUnitInfo`,
        method: 'post',
        data: _this.unitInfo
      }).then((res) => {
        if(res.data.code == 200){
          alert("修改成功");
        }else{
          alert("修改失败");
        }
      })
    }
  }
}
</script>

<style scoped>
@import "@/assets/css/unit_andreas08(blue).css";
</style>
